//
//  UIImage+Extra.m
//  ZYWebImage
//
//  Created by wangzhipan on 2025/3/19.
//

#import "UIImage+Extra.h"
#import <objc/runtime.h>

static const char kFormatKey;

@implementation UIImage (Extra)
- (ZYImageFormat)zy_format
{
    return [objc_getAssociatedObject(self, &kFormatKey) intValue];
}

- (void)setZy_format:(ZYImageFormat)format
{
    objc_setAssociatedObject(self, &kFormatKey, @(format), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (NSDictionary *)zy_allExtraInfo
{
    return @{
        kExtraFormat: @(self.zy_format)
    };
}

- (void)zy_configExtraInfo:(NSDictionary *)extraInfo
{
    self.zy_format = [extraInfo[kExtraFormat] intValue];
}
@end
